package training.osms.view.category;

import java.util.List;

import training.osms.controller.category.CategoryController;
import training.osms.model.category.Category;
import training.osms.model.category.CategorySearch;

public class CategoryForm {

	private Category category;
	private List<Category> categories;
	
	public CategoryForm(){
		this(new Category());
		
	}
	
	public CategoryForm(Category category){
		this.category = category;
		this.categories = searchCategories();
	}
	
	private List<Category> searchCategories() {
		CategoryController controller = new CategoryController();
		CategorySearch search = new CategorySearch();
		return controller.searchCategory(search);
	}

	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	public List<Category> getCategories() {
		return categories;
	}
	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}
	
	
}
